/**
 * Created by IntelliJ IDEA.
 * User: Bezdelnick
 * Date: 13.09.12
 * Time: 12:21
 * To change this template use File | Settings | File Templates.
 */
package fgui {
import flash.geom.Point;

import mx.core.UIComponent;

/**
 * Class extends UIComponent and implement simply methods for drawing.
 *
 * @see fgui.UIGraphicsComponent
 */
public class UIGraphicsComponent extends UIComponent {
    public function UIGraphicsComponent() {
        super();
    }

    public function drawLine(thickness:int, color:uint, alpha:Number, begin:Point, end:Point):void {
        this.graphics.lineStyle(thickness, color, alpha);
        this.graphics.moveTo(begin.x, begin.y);
        this.graphics.lineTo(end.x, end.y);
    }

    /**
     *
     * @param color
     * @param alpha
     * @param begin
     * @param end
     */
    public function drawRectangle(color:uint, alpha:Number, begin:Point, end:Point):void {
        this.graphics.beginFill(color, alpha);
        this.graphics.drawRect(begin.x, begin.y, end.x, end.y);
        this.graphics.endFill();
    }

    public function drawBorderRectangle(thickness:int, color:uint, alpha:Number, begin:Point, end:Point):void {
        this.graphics.lineStyle(thickness, color, alpha);
        this.graphics.drawRect(begin.x, begin.y, end.x - begin.x, end.y - begin.y);
    }

    /**
     *
     * @param color - color of backgroun
     * @param alpha - alpha of component
     * @param begin - begin point for drawing
     * @param end - end point for drawing
     * @param ellipseSize - params for rectangle rounding
     */
    public function drawRoundedRectangle(color:uint, alpha:Number, begin:Point, end:Point, ellipseSize:Point):void {this.graphics.clear();
        this.graphics.beginFill(color, alpha);
        this.graphics.drawRoundRect(begin.x, begin.y, end.x, end.y, ellipseSize.x, ellipseSize.y);
        this.graphics.endFill();
    }
}
}
